﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="PR_BudgetManagementTest.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.PR_BudgetManagementTest" %>

<%@ Register src="../Controls/EmployeeTypeCombo.ascx" tagname="EmployeeTypeCombo" tagprefix="uc1" %>
<%@ Register src="../Controls/JobSiteCombo.ascx" tagname="JobSiteCombo" tagprefix="uc2" %>
<%@ Register src="../Controls/MasterYear.ascx" tagname="MasterYear" tagprefix="uc3" %>
<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc4" %>
<asp:Content ID="Content1" runat="server" contentplaceholderid="ContentPlaceHolder1">  
<script type="text/javascript">   

          function isNumberKey(event)  // ตัวเลขอย่างเดียว
          {
             var charCode = (event.which) ? event.which : event.keyCode
             if(charCode > 31 && (charCode < 48 || charCode > 57)){
//                 alert("กรอกได้แต่ตัวเลขครับ!")
                 return false;
	          }
             return true;
          }
           function onTextChange(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
          } 
                    
            function openProjectDetails(id) 
                {               
                   radopen("PR_BudgetManagementTestDtl.aspx?mng_test_seq=" + id, "ProjectDtls");
                   
                    return false;
                }
             function Addnew() {
                 return false;
             }

             function onClickSearch() {
                 var radioPeriod = document.getElementById("<%=radPeriod.ClientID%>");
                 var radioPromotion = document.getElementById("<%=radPromotion.ClientID%>");
                 var comboJobSite = $find('<%= JobSiteCombo.FindControl("cbJobSite").ClientID %>');
                 var comboEmployeeType = $find("<%=cbEmployeeType.ClientID%>");
                 var comboYear = $find("<%=cbYear.ClientID%>");
                 var lbl = document.getElementById("<%=lblTypeYear.ClientID%>").innerHTML;
                 //alert(comboJobSite.get_selectedItem().get_text());
                 if (comboJobSite.get_selectedItem() == null) {
                     alert("กรุณาเลือก'สำนัก / กอง'");
                     return false;
                 }
                 if (comboEmployeeType.get_selectedItem() == null) {
                     alert("กรุณาเลือก ประเภทบุคลากร");
                     return false;
                 }
                 if (comboYear.get_selectedItem() == null) {
                     alert("กรุณาเลือก " + lbl);
                     return false;
                 }
                 if (radioPromotion == null) {
                     alert("ไม่มีข้อมูลการเลื่อนเงินเดือน " + lbl + " " + comboYear.get_selectedItem().get_text());
                     return false;
                 } 
                 if (radioPeriod == null) {
                     alert("ไม่มีข้อมูลรอบการประเมินใน " + lbl + " " + comboYear.get_selectedItem().get_text());
                     return false;
                 }
                 return true;
             }
</script>
      
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

       <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
    </telerik:RadAjaxLoadingPanel>
    
    
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
<Windows>
    <telerik:RadWindow 
        id="ProjectDtls" 
        runat="server"
        showcontentduringload="false"
        VisibleStatusbar="false"
        title="แบบทดสอบการบริหารวงเงิน"
        width="1000px"
        Height="650px"        
        Modal="true"
        behaviors="Close">
    </telerik:RadWindow>
</Windows>

        <Windows>
            <telerik:RadWindow 
                ID="RadWindow1"  
                DestroyOnClose = "true"               
                Modal ="true"                
                VisibleStatusbar ="false"
                runat="server">
            </telerik:RadWindow>
        </Windows>


</telerik:RadWindowManager>
    
    <title>แบบทดสอบวงเงินการเลื่อนเงินเดือน</title>
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" /> 
    
      <asp:panel ID="Panel6" runat="server" >
    <table width="1000" cellpadding="0" cellspacing="0">
        <tr>
            <td width="280" valign = "top">
               <!-- <uc4:user ID="user1" runat="server" /> -->
            </td>
            
            <td width="20" >
            
            <td>
            
            <div class="moduleDivSlim700">
                    <div class="moduleDivBottom700">
                         <asp:Panel ID="PanelFilter" runat="server" Width="700px" ScrollBars="Auto">
                            <table align = "center" width = "650px">
                                    <tr>
                                        <td align="left" style="width: 180px" >
                                            กรม :<asp:Label ID="lblDepName" runat="server" Text="lblDepName"></asp:Label>
&nbsp;</td>
                                        <td align="right">
                                            สำนัก / กอง :</td>
                                        
                                       <td>
                                            <uc2:JobSiteCombo ID="JobSiteCombo" runat="server" />
                                        </td>
                                    </tr>
                                </table>
                        </asp:Panel>
                    </div>
                </div>
            
            
            </td>
            
          </tr>
          </table>
          
          <tr>
          <td>
          
          <table>
                  <tr>
                      <td>
                          <table>
                              <tr>
                                  <td>
                                      <div class="moduleDivSlim1000">
                                          <div class="moduleDivBottom1000">
                                              <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                                  <ContentTemplate>
                                                      <asp:Panel ID="Panel22" runat="server" ScrollBars="Auto" Width="1000px">
                                                          <table align="center" width="100%">
                                                              <tr>
                                                                  <td align="right" style="width: 189px">
                                                                      ประเภทบุคลากร :</td>
                                                                  <td style="width: 309px">
                                                                      <telerik:RadComboBox ID="cbEmployeeType" runat="server" AutoPostBack="True" 
                                                                          CausesValidation="false" DataTextField="Name" DataValueField="Sequence" 
                                                                          EmptyMessage="... ประเภทบุคลากร..." Filter="Contains" 
                                                                          OnClientTextChange="onTextChange" 
                                                                          onselectedindexchanged="cbEmployeeType_SelectedIndexChanged" Width="200px">
                                                                      </telerik:RadComboBox>
                                                                  </td>
                                                                  <td style="width: 95px" align="right">
                                                                      <asp:Label ID="lblTypeYear" runat="server" Text="lblTypeYear"></asp:Label>
                                                                  </td>
                                                                  <td style="width: 107px">
                                                                      <telerik:RadComboBox ID="cbYear" runat="server" AllowCustomText="true" 
                                                                          AutoPostBack="True" CausesValidation="false" DataTextField="Name" 
                                                                          DataValueField="Name" EmptyMessage="...เลือกปี ..." Filter="Contains" 
                                                                          OnClientTextChange="onTextChange" 
                                                                          onselectedindexchanged="cbYear_SelectedIndexChanged" Width="100px">
                                                                      </telerik:RadComboBox>
                                                                  </td>
                                                                  <td>
                                                                      &nbsp;</td>
                                                              </tr>
                                                              <tr>
                                                                  <td align="right" style="width: 189px" valign="top">
                                                                      การเลื่อนเงินเดือน :</td>
                                                                  <td style="width: 309px">
                                                                      <asp:RadioButtonList ID="radPromotion" runat="server" 
                                                                          RepeatDirection="Horizontal">
                                                                          <asp:ListItem Value="1">ครั้งที่ 1</asp:ListItem>
                                                                          <asp:ListItem Value="2">ครั้งที่ 2</asp:ListItem>
                                                                      </asp:RadioButtonList>
                                                                  </td>
                                                                  <td style="width: 95px" align="right" valign="top">
                                                                      รอบการประเมิน :</td>
                                                                  <td colspan="2">
                                                                      <asp:RadioButtonList ID="radPeriod" runat="server" RepeatDirection="Horizontal">
                                                                          <asp:ListItem Selected="True" Value="1">ครั้งที่ 1</asp:ListItem>
                                                                          <asp:ListItem Value="2">ครั้งที่ 2</asp:ListItem>
                                                                      </asp:RadioButtonList>
                                                                  </td>
                                                              </tr>
                                                              <tr>
                                                                  <td align="right" style="width: 189px">
                                                                      &nbsp;</td>
                                                                  <td style="width: 309px">
                                                                      &nbsp;</td>
                                                                  <td style="width: 95px">
                                                                      &nbsp;</td>
                                                                  <td colspan="2">
                                                                      &nbsp;</td>
                                                              </tr>
                                                          </table>
                                                      </asp:Panel>
                                                  </ContentTemplate>
                                              </asp:UpdatePanel>
                                              <table style="width:100%;">
                                                  <tr>
                                                      <td style="width: 188px">
                                                          &nbsp;</td>
                                                      <td>
                                                          <asp:Button ID="cmdSearch" runat="server" onclick="cmdSearch_Click" 
                                                                Text="ค้นหา" Width="104px" />
                                                      </td>
                                                      <td>
                                                          &nbsp;</td>
                                                  </tr>
                                              </table>
                                          </div>
                                      </div>
                                  </td>
                              </tr>
                          </table>
                      </td>
                  </tr>
              </table>

          </td>
          
          
          </tr>
          
          
          <tr>
          <td colspan = "3">
        <div class="moduleDivSlim1000">
        <div class="moduleDivBottom1000">
        <table align="center" width ="980px" >
        <tr>
            <td align="left" class="tableHeader">
                แบบทดสอบวงเงินการเลื่อนเงินเดือน</td>
        </tr>
        </table>
        <table width ="980px" >
        <tr>
        <td >
        <asp:Panel ID="PanelGrid" 
            runat="server" 
            Width="980px" 
            Height="350px" ScrollBars="Auto" >
                <telerik:RadGrid ID="RadGrid2" runat="server" AllowFilteringByColumn="True" AllowAutomaticDeletes="True"
                    AllowMultiRowEdit="True" AllowMultiRowSelection="True" AllowPaging="True" 
                    AllowSorting="True" AutoGenerateColumns="False" EnableAJAX="True" 
                    EnableAJAXLoadingTemplate="True" GridLines="None" 
                    OnItemCommand="RadGrid2_ItemCommand" Skin="Outlook" Width="100%" 
                    onitemdatabound="RadGrid2_ItemDataBound" >
                    <MasterTableView 
                    AllowMultiColumnSorting="True" 
                    CellSpacing="-1" 
                        ClientDataKeyNames="mng_test_seq"
                         CommandItemDisplay="None"
                         DataKeyNames="mng_test_seq" 
                        InsertItemPageIndexAction="ShowItemOnCurrentPage" 
                        NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                        <CommandItemTemplate>
                            <table width="100%">
                                <tr>
                                    <td>
                                        <asp:LinkButton ID="cmdAddNew" runat="server" CausesValidation="False" 
                                            CommandName="InitInsert" 
                                            Visible="<%# !RadGrid2.MasterTableView.IsItemInserted && RadGrid2.EditIndexes.Count <= 0 %>"> <img alt="" src="../Images/Buttons/AddRecord.gif" 
                                            style="border: 0px; vertical-align: middle;" /> เพิ่มแบบทดสอบ</asp:LinkButton>
                                        &nbsp;&nbsp;
                                    </td>
                                    <td align="right">
                                    </td>
                                </tr>
                            </table>
                        </CommandItemTemplate>
                        <RowIndicatorColumn>
                            <HeaderStyle Width="20px" />
                        </RowIndicatorColumn>
  
                        <ExpandCollapseColumn Visible="True">
                        </ExpandCollapseColumn>
                              
                        <Columns>
                            <telerik:GridEditCommandColumn 
                             EditText = "คลิกเพื่อแก้ไขรายการ"
                                        ButtonType="ImageButton">
                                        <HeaderStyle HorizontalAlign="Center" Width="15px" />
                                        <ItemStyle HorizontalAlign="Center" Width="15px" />                                      
                            </telerik:GridEditCommandColumn>                          
                                                        
                            <telerik:GridButtonColumn ButtonType="ImageButton" 
                                CommandName="Delete" 
                                ConfirmDialogType="RadWindow" ConfirmText="ลบข้อมูลที่เลือก?" 
                                Text="คลิกเพื่อลบข้อมูล" 
                                UniqueName="column1">
                                <HeaderStyle HorizontalAlign="Center" Width="10px" />
                                <ItemStyle HorizontalAlign="Center" Width="10px" />
                            </telerik:GridButtonColumn>                           
                            <telerik:GridTemplateColumn 
                                AutoPostBackOnFilter="true" 
                                ShowFilterIcon="false" 
                                CurrentFilterFunction="Contains" 
                                DataField="mng_test_name" 
                                FilterControlWidth="100%" 
                                HeaderStyle-HorizontalAlign="Center" HeaderText="ชื่อแบบทดสอบ" >               
                
                                <ItemTemplate>              
                                    <asp:LinkButton ID="targetControl" runat="server" Text='<%# Eval("mng_test_name") %>' OnClientClick='<%# string.Format("return openProjectDetails(\"{0}\");", Eval("mng_test_seq")) %>' 
                                        ></asp:LinkButton>
                                </ItemTemplate>               

                            <HeaderStyle HorizontalAlign="Center" />
                            </telerik:GridTemplateColumn>

                            <telerik:GridTemplateColumn
                                DataField="apr_year" 
                                HeaderText="ปีงบประมาณ" 
                                ShowFilterIcon="false"
                                FilterControlWidth="100%"
                                CurrentFilterFunction="Contains"
                                AutoPostBackOnFilter="true"
                                UniqueName="AprYear" >                                
                                <ItemTemplate>
                                    <%# Eval("apr_year")%>                        
                                </ItemTemplate>
                                
                                <ItemStyle Width="10%" />
                                
                    </telerik:GridTemplateColumn>
                            
                       <telerik:GridTemplateColumn
                            DataField="apr_period"
                             HeaderText="รอบประเมิน" 
                                 ShowFilterIcon="false"
                               FilterControlWidth="100%"
                               CurrentFilterFunction="Contains"
                               AutoPostBackOnFilter="true"
                                UniqueName="AprPeriod">
                                   <ItemTemplate>
                                    <%# Eval("apr_period")%>                        
                                             </ItemTemplate>
                           </telerik:GridTemplateColumn>
 
                           <telerik:GridTemplateColumn
                                DataField="amount_net"                                 
                                HeaderText="งบประมาณที่ได้รับจัดสรร" 
                                ShowFilterIcon="false"
                                FilterControlWidth="100%"
                                CurrentFilterFunction="Contains"
                                AutoPostBackOnFilter="true"
                                UniqueName="amount_net">                                
                                <ItemTemplate>
                                    <%# Eval("amount_net", "{0:N2}")%>                        
                                </ItemTemplate>
                                             
                           </telerik:GridTemplateColumn>
                           <telerik:GridTemplateColumn
                                DataField="sum_amount"                             
                                HeaderText="งบประมาณขาดเกิน" 
                                ShowFilterIcon="false"
                                FilterControlWidth="100%"
                                CurrentFilterFunction="Contains"
                                AutoPostBackOnFilter="true"
                                UniqueName="sum_amount">
                                <ItemTemplate>
                                    <%# Eval("sum_amount")%>                        
                                </ItemTemplate>
                           <ItemStyle Width="100px" />
                           </telerik:GridTemplateColumn>
                           <telerik:GridTemplateColumn
                                DataField="confirm" 
                                HeaderText="ยืนยัน" 
                                ShowFilterIcon="false"
                                FilterControlWidth="100%"
                                CurrentFilterFunction="Contains"
                                AutoPostBackOnFilter="true"
                                UniqueName="Confirm" Visible="False">                                
                                <ItemTemplate>
                                    <%# Eval("confirm")%>                        
                                </ItemTemplate>                                             
                           </telerik:GridTemplateColumn>                         
                           <telerik:GridBoundColumn DataField="confirm" HeaderText="ยืนยัน" 
                                ShowFilterIcon="false"
                                FilterControlWidth="100%"
                                UniqueName="Confirm2">
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Center" />
                            </telerik:GridBoundColumn>                             
                            <telerik:GridTemplateColumn
                                DataField="prm_seq" 
                                HeaderText="prm_seq" 
                                ShowFilterIcon="false"
                                FilterControlWidth="100%"
                                CurrentFilterFunction="Contains"
                                AutoPostBackOnFilter="true"
                                UniqueName="prm_seq" Visible="False">
                                <ItemTemplate>
                                    <%# Eval("prm_seq")%>                        
                                </ItemTemplate>
                           </telerik:GridTemplateColumn>
                        </Columns>
                        <EditFormSettings EditFormType="WebUserControl" 
                            UserControlName="../UserControls/PR_BudgetManagementTest.ascx">
                            <EditColumn UniqueName="EditCommandColumn1">
                            </EditColumn>
                        </EditFormSettings>
                        <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                    </MasterTableView>
                    <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True" 
                        EnableRowHoverStyle="True" ReorderColumnsOnClient="True">
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                    </ClientSettings>
                </telerik:RadGrid>
            </asp:Panel>
                </td>
                </tr>
                </table>
                </div>
</div>
</td>
</tr>
</table>
</asp:panel>

</asp:Content>
